// 路由拦截器
export const routeInterceptor = {
  install(Vue) {
    Vue.mixin({
      beforeRouteEnter(to, from, next) {
        // 需要登录的页面路径
        const needLoginPaths = ['/pages/main/user']
        
        if (needLoginPaths.includes(to.path)) {
          if (!this.$store.state.user.isLogin) {
            next('/pages/auth/login')
            return
          }
        }
        next()
      }
    })
  }
}